﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ComponentModel.DataAnnotations;
using System.Web.Script.Serialization;

namespace CodeStash.Common.DataAccess.EntityFramework
{
    /// <summary>
    /// The forum comments for a particular snippet.
    /// </summary>
    [DataContract]
    public class CodeSnippetForumMessage
    {
        public CodeSnippetForumMessage()
        {
        }

        public CodeSnippetForumMessage(string messageText, Guid aspNetMembershipUserId, DateTime created, int codeSnippetId)
        {
            this.MessageText = messageText;
            this.AspNetMembershipUserId = aspNetMembershipUserId;
            this.Created = created;
            this.CodeSnippetId = codeSnippetId;
        }

        [Key]
        [DataMember]
        public int CodeSnippetForumMessageId { get; set; }

        [DataMember]
        public string MessageText { get; set; }

        [DataMember]
        public Guid AspNetMembershipUserId { get; set; }

        [DataMember]
        public DateTime Created { get; set; }

        [ForeignKey("CodeSnippetId")]
        [DataMember]
        public int CodeSnippetId { get; set; }

        [DataMember]
        [ScriptIgnore]
        public CodeSnippet CodeSnippet { get; set; }
    }
}
